package com.wyc.serviceMap.service.impl;

import com.wyc.internalCommon.request.DirectionDTO;
import com.wyc.internalCommon.request.ForecastPriceDTO;
import com.wyc.internalCommon.result.ApiResult;
import com.wyc.serviceMap.remote.MapDirectionClient;
import com.wyc.serviceMap.service.DirectionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class DirectionServiceImpl implements DirectionService {

    @Autowired
    private MapDirectionClient mapDirectionClient;

    /**
     * 根据起点/终点经纬度获取距离和时长
     * @param forecastPriceDTO
     * @return
     */
    @Override
    public ApiResult driving(ForecastPriceDTO forecastPriceDTO) {

        // 调用第三方高德地图接口
        DirectionDTO direction = mapDirectionClient.direction(forecastPriceDTO);

        return ApiResult.success(direction);
    }
}
